home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / book / Chap03 / Simple / Simple.c next >
Encoding:
C/C++ Source or Header  |  1999-09-23  |  670 b   |  39 lines

  1. // Simple.c
  2. // The Simplest OpenGL program with GLUT
  3. // OpenGL SuperBible, 2nd Edition
  4. // Richard S. Wright Jr.
  5.  
  6. #include <windows.h>
  7. #include <gl/glut.h>
  8.  
  9. // Called to draw scene
  10. void RenderScene(void)
  11.     {
  12.     // Clear the window with current clearing color
  13.     glClear(GL_COLOR_BUFFER_BIT);
  14.  
  15.  
  16.     // Flush drawing commands
  17.     glFlush();
  18.     }
  19.  
  20. // Setup the rendering state
  21. void SetupRC(void)
  22.     {
  23.     glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
  24.     }
  25.  
  26.  
  27. // Main program entry point
  28. void main(void)
  29.     {
  30.     glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  31.     glutCreateWindow("Simple");
  32.     glutDisplayFunc(RenderScene);
  33.  
  34.     SetupRC();
  35.  
  36.     glutMainLoop();
  37.     }
  38.  
  39.